package com.deuwise.job.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.annotations.TableField;
import com.deuwise.common.validator.group.AddGroup;
import com.deuwise.common.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.Date;

/**
 * 任务调度
 *@author deuwise
 *@date 2018-11-26 10:50:40
 */
@Data
@EqualsAndHashCode(callSuper=true)
@TableName("sys_task")
public class TaskDo extends Model<TaskDo> implements Serializable{
    /**主键id*/
    @ApiModelProperty("主键id")
    @TableId
    private String id;

    /**cron表达式*/
    @ApiModelProperty("cron表达式")
    @TableField("cron_expression")
    @NotBlank(message="cron表达式不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String cronExpression;

    /**执行类方法名称*/
    @ApiModelProperty("执行类方法名称")
    @TableField("method_name")
    @NotBlank(message="执行类方法名称不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String methodName;

    /**任务是否有状态*/
    @ApiModelProperty("任务是否有状态")
    @TableField("is_concurrent")
    private Integer isConcurrent;

    /**描述*/
    @ApiModelProperty("描述")
    @TableField("description")
    private String description;

    /**启用状态*/
    @ApiModelProperty("启用状态")
    @TableField("job_status")
    private Integer jobStatus;

    /**任务名称*/
    @ApiModelProperty("任务名称")
    @TableField("job_name")
    @NotBlank(message="任务名称不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String jobName;

    /**任务分组(集群使用)*/
    @ApiModelProperty("任务分组(集群使用)")
    @TableField("job_group")
    private String jobGroup;

    @ApiModelProperty("创建时间")
    @TableField("create_time")
    private Date createTime;

    @ApiModelProperty("修改时间")
    @TableField("update_time")
    private Date updateTime;

    @Override
    protected Serializable pkVal() {
        return id;
    }
}